package cs.upt.awp.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import cs.upt.awp.dao.TravelRecordsDAO;
import cs.upt.awp.data.TravelRecord;

public class TravelRecordsServices implements DataServices<TravelRecord> {

	@Autowired
	TravelRecordsDAO recordsDao;

	@Override
	public boolean addEntity(TravelRecord record) throws Exception {
		return recordsDao.addEntity(record);
	}
	
	public boolean updateEntity(TravelRecord record) throws Exception {
		return recordsDao.updateEntity(record);
	}

	@Override
	public TravelRecord getEntityById(long id) throws Exception {
		return recordsDao.getEntityById(id);
	}

	@Override
	public List<TravelRecord> getEntityList() throws Exception {
		return recordsDao.getEntityList();
	}

	@Override
	public boolean deleteEntity(long id) throws Exception {
		return recordsDao.deleteEntity(id);
	}
	
	public List<TravelRecord> getUserRecords( String userName) throws Exception {
		return recordsDao.getUserRecords(userName);
	}

}
